package com.sykj.springboot.common.entity;

import com.google.gson.Gson;

import java.io.Serializable;

public class DataResponse implements Serializable
{

    private static final long serialVersionUID = -909849870543896791L;

    public static final String STATUS_S = "S";
    public static final String STATUS_F = "F";
    public static final String STATUS_T = "T";
    public static final String MSG_S = "操作成功";
    public static final String MSG_F = "操作失败";
    public static final String MSG_T = "登陆超时";

    public DataResponse(){
        this.msg = MSG_S;
        this.status = STATUS_S;
    }

    public DataResponse(String msg)
    {
        this.msg = msg;
        this.status = STATUS_F;
    }

    public DataResponse(String status, String msg)
    {
        this.status = status;
        this.msg = msg;
    }

    private String status;

    private String msg;

    private Object data;

    public String getStatus()
    {
        return this.status;
    }

    public void setStatus(String status)
    {
        if("S".equals(status)){
            this.msg = MSG_S;
        }else if("T".equals(status)){
            this.msg = MSG_T;
        }
        this.status = status;
    }

    public String getMsg()
    {
        return this.msg;
    }

    public void setMsg(String msg)
    {
        this.msg = msg;
    }

    public Object getData()
    {
        return data;
    }

    public void setData(Object data)
    {
        this.data = data;
    }

    public static void main(String[] args)
    {
        System.out.println( new Gson().toJson(new  DataResponse(STATUS_S,MSG_S)));
    }
}
